#ifndef NRF24L01_H
#define NRF24L01_H

#include "nrf24l01_defines.h"
#include <stdint.h>
#include <Arduino.h>

class nRF24L01
{
public:
    nRF24L01();

    //-- program ----------
    uint8_t startRecvData (uint8_t *data);
    uint8_t Tx_Packages (uint8_t data[]);
    //------------------------------------------
    void applyRFSettings (uint8_t localAddr[]);
    //-- tools -------
    uint8_t writeData (uint8_t data);

    uint8_t writeValueToRegister(uint8_t regAddr,uint8_t value);
    uint8_t readValueFromRegister (uint8_t regAddr);

    uint8_t writeBuffToRegister (uint8_t regAddr, uint8_t buff[], uint8_t len);
    uint8_t readBuffFromRegister (uint8_t regAddr,uint8_t buff[],uint8_t len);
    uint8_t checkACK();
    //-- status operate -----
    void Rx_Modestart ();
    void standBy_Two ();
    void standBy_One ();
    void flushAll ();
    //---pin operate----
    void ceHigh();
    void ceLow ();
    void csnHigh();
    void csnLow ();
    void initPins();
    
    uint8_t mCE;
    uint8_t mCSN;
    uint8_t mSCK;
    uint8_t mMOSI;
    uint8_t mMISO;
    uint8_t mIRQ;

    uint8_t txPayload;
    uint8_t addrWidth;
};

#endif // NRF24L01_H
